import java.util.*;
public class Main{
    /**
     * 字符串缩写
     * https://www.nowcoder.com/practice/c43a0d72d29941c1b65c857d8ac9047e?tpId=196&tqId=39317&ru=/exam/oj
     * @param param
     * @return
     */
    public String compressString (String param)
    {
        char[] s = param.toCharArray();

        int left = 0,right = 0,n = s.length;

        StringBuilder st = new StringBuilder();

        while(left < n)
        {
            while(right + 1 < n && s[right] == s[right+1]) right++;

            st.append(s[right]);
            if(right - left + 1 > 1) st.append(right - left + 1);

            left = right + 1;
            right = left;
        }

        return st.toString();
    }

    /**
     * topK问题
     * @param args
     */
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);

            int n = in.nextInt(), k = in.nextInt();

            Orange[] o = new Orange[n];

            for (int i = 0; i < n; i++) {
                o[i] = new Orange();
                o[i].a = in.nextInt();
            }
            for (int i = 0; i < n; i++) {
                o[i].b = in.nextInt();
            }

            //排序
            Arrays.sort(o, (x, y) -> {
                if (x.b == y.b) return x.a - y.a;
                else return y.b - x.b;
            });


            //输出
            long sum1 = 0, sum2 = 0;
            for (int i = 0; i < k; i++) {
                sum1 += o[i].a;
                sum2 += o[i].b;
            }

            System.out.println(sum1 + " " + sum2);
        }

    /**
     * 01背包
     * https://www.nowcoder.com/practice/2820ea076d144b30806e72de5e5d4bbf?tpId=196&tqId=37561&ru=/exam/oj
     * https://ac.nowcoder.com/acm/problem/26221
     */
    //dp表
    static int[] dp = new int[1001];

    public int knapsack (int V, int n, int[][] vw)
    {
        for(int i = 0;i < n;i++)
        {
            for(int j = V ;j >= vw[i][0];j--)
            {
                dp[j] = Math.max(dp[j],dp[j - vw[i][0]] + vw[i][1]);
            }
        }

        return dp[V];
    }

}
class Orange
{
    int a;
    int b;

    public Orange(int a,int b)
    {
        this.a = a;
        this.b = b;
    }
    public Orange(){}
}